﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace ProgressBarTest.Converters
{
    public class IntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double? dVal = value as double?;
            return (int)dVal.GetValueOrDefault();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value as int?;
        }
    }
}
